package com.cskaoyan.mapper;

import com.cskaoyan.bean.Teacher;
import org.apache.ibatis.annotations.Param;

import java.util.Map;

public interface TeacherMapper {

    // 一个简单参数
    String selectNameById(@Param("id") Integer id);


    // 多个简单参数
    int updateTeacherNameById(@Param("xxxname") String name, @Param("xxxid") Integer id);


    // 传递对象
    int insertTeacher(Teacher teacher);

    // 传递对象
    int insertTeacherWithParam(@Param("teacher") Teacher teacher);


    // 复合参数 根据id来修改name和nickname
    int updateTeacherById(@Param("id") Integer id, @Param("teacher") Teacher teacher);


    // 使用map传值
    int insertTeacherByMap(Map map);

    // 按位置来取值
    int insertTeacher2(Integer id,String name,String nickname,String gender);


    // 使用${}来取值
    Teacher selectTeacherById$(@Param("id") Integer id);

    // 传递表名
    Teacher selectTeacherByIdAndTableName(@Param("id") Integer id,@Param("tableName") String tableName);


    Teacher selectTeacherByName(@Param("name") String name);

}
